package com.hhq.sso.protocol.oauth2.service;

import com.hhq.sso.protocol.oauth2.repository.SsoUserRepository;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

/**
 * <p>
 * Description: some description
 * </p>
 *
 * @author : xiaodong.yang
 * @date : 2024/6/18 17:54
 */

public class SsoUserService implements UserDetailsService {

    private SsoUserRepository ssoUserRepository;

    public SsoUserService(SsoUserRepository ssoUserRepository) {
        this.ssoUserRepository = ssoUserRepository;
    }

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return ssoUserRepository.findByUsername(username);
    }
}
